package com.zhny.sensor.service;

import com.zhny.sensor.dao.SlaughterHousePoultryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * @Auther: zhy
 * @Date: 2019/11/23
 * @Description: 屠宰场禽类品种信息更新服务
 */
@Service
public class SlaughterHousePoultryService {

    @Autowired
    private SlaughterHousePoultryRepository slaughterHousePoultryRepository;

    /**
     * 根据id查询寻脚标机用户信息更新状态   0：未更新，1：更新
     *
     * @param slaughterHouseId 屠宰场编号
     * @return BarcodeMachineUser
     */
    public String getIsupdateByMachineId(String slaughterHouseId ) {
        return slaughterHousePoultryRepository.findIsupdateByBarcodeMachineId(slaughterHouseId);
    }


    /**
     * 根据id设置寻脚标机用户信息更新状态   0：未更新，1：更新
     *
     * @param deviceId 设备编号
     * @return BarcodeMachineUser
     */
    @Transactional
    public int setIsupdateByMachineId(String deviceId ) {
        return slaughterHousePoultryRepository.setIsupdateByBarcodeMachineId(deviceId);
    }

    /**
     * 根据id查询寻脚标机用户时间版本信息
     *
     * @param slaughterHouseId 屠宰场编号
     * @return BarcodeMachineUser
     * @author minxin
     */
    public String getTimeVersionByMachineId(String slaughterHouseId ) {
        return slaughterHousePoultryRepository.findTimeVersionByBarcodeMachineId(slaughterHouseId);
    }
    /**
     * 根据id设置寻脚标机用户时间版本信息
     *
     * @param slaughterHouseId 屠宰场编号
     * @return BarcodeMachineUser
     * @author minxin
     */
    @Transactional
    public int setTimeVersionByMachineId(String timeVersion , String slaughterHouseId ) {
        return slaughterHousePoultryRepository.setTimeVersionByBarcodeMachineId(timeVersion,slaughterHouseId);
    }
}
